# Directory and files where is stored Copr database files
DATA_DIR = '/var/lib/copr/data'
DATABASE = '/var/lib/copr/data/copr.db'
OPENID_STORE = '/var/lib/copr/data/openid_store'
WHOOSHEE_DIR = '/var/lib/copr/data/whooshee'
WHOOSHEE_MIN_STRING_LEN = 2
WHOOSHEE_WRITER_TIMEOUT = 10

SECRET_KEY = '{{ copr_secret_key }}'
BACKEND_PASSWORD = '{{ copr_backend_password  }}'
BACKEND_BASE_URL = '{{ backend_base_url }}'

# restrict access to a set of users
#USE_ALLOWED_USERS = False
#ALLOWED_USERS = ['bonnie', 'clyde']

SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://copr-fe:{{ copr_database_password }}@/coprdb'

# Token length, defaults to 30 (max 255)
#API_TOKEN_LENGTH = 30

# Expiration of API token in days
#API_TOKEN_EXPIRATION = 180

# logging options
#SEND_LOGS_TO = ['root@localhost']
#LOGGING_LEVEL = logging.ERROR

DEBUG = False
SQLALCHEMY_ECHO = False

CSRF_ENABLED = True
WTF_CSRF_ENABLED = True

# send emails when user's perms change in project?
SEND_EMAILS = True

PUBLIC_COPR_HOSTNAME = "{{ copr_frontend_public_hostname }}"

LOG_FILENAME = "/var/log/copr-frontend/frontend.log"
LOG_DIR = "/var/log/copr-frontend/"

# to accept stat events from logstash
INTRANET_IPS = {{ copr_backend_ips }}

REPO_GPGCHECK = {% if devel %} 0 {% else %} 1 {% endif %}

{% if env == 'staging' %}
PUBLIC_COPR_BASE_URL = "http://copr-fe-dev.cloud.fedoraproject.org"
{% else %}
PUBLIC_COPR_BASE_URL = "https://copr.fedorainfracloud.org"
{% endif %}

{% if env == 'staging' %}
# Staging URLs for fedmenu
FEDMENU_URL = "https://apps.stg.fedoraproject.org/fedmenu/"
FEDMENU_DATA_URL = "https://apps.stg.fedoraproject.org/js/data.js"
{% else %}
# Production URLs for fedmenu
FEDMENU_URL = "https://apps.fedoraproject.org/fedmenu/"
FEDMENU_DATA_URL = "https://apps.fedoraproject.org/js/data.js"
{% endif %}

# todo: check that ansible variable is used correctly
{% if env == 'staging' %}
ENFORCE_PROTOCOL_FOR_BACKEND_URL = "http"
ENFORCE_PROTOCOL_FOR_FRONTEND_URL = "http"
{% else %}
ENFORCE_PROTOCOL_FOR_BACKEND_URL = "https"
ENFORCE_PROTOCOL_FOR_FRONTEND_URL = "https"
{% endif %}

DIST_GIT_URL="http://{{ dist_git_base_url }}/cgit"
DIST_GIT_CLONE_URL="http://{{ dist_git_base_url }}/git"
COPR_DIST_GIT_LOGS_URL = "http://{{ dist_git_base_url }}/per-task-logs"
MBS_URL = "http://localhost/module/1/module-builds/"

# no need to filter cla_* groups, they are already filtered by fedora openid
BLACKLISTED_GROUPS = ['fedorabugs', 'packager', 'provenpackager']

DEFER_BUILD_SECONDS = 300
